package level4Assessment;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Date;

public class TransactionWriter 
{
	public TransactionWriter(int transactionNum, String reg, int arrivalHour, int arrivalMinute, int exitTimeHour, int exitTimeMinute, int lengthHour, int lengthMin, double totalPrice)
	{
		try(
			BufferedWriter output = new BufferedWriter(new FileWriter("D:\\Users\\josjenki\\Desktop\\Transactions.csv", true))
			)
			{ 
				System.out.println("Test");
				output.write(transactionNum + ", " + reg + ", " + new Date() + "," + arrivalHour + ":" + arrivalMinute + "," + exitTimeHour + ":" + exitTimeMinute + "," + lengthHour + ":"+ lengthMin +"," +  totalPrice);
				output.newLine();
			}catch(IOException e)
				{
					System.out.println("Exception: " + e);
				}
	}
}
